package com.hyts.standard.webflux.handler.user;

import com.hyts.standard.webflux.base.handler.AbstractCrudDataHandler;
import com.hyts.standard.webflux.bean.dto.UserDTO;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.reactive.function.server.ServerResponse;
import reactor.core.publisher.Mono;

/**
 * @project-name:standard-webflux
 * @package-name:com.hyts.standard.webflux.handler
 * @author:Libo/Alex
 * @create-date:2019-06-19 10:07
 * @email:liboware@gmail.com
 * @description:此类主要用于: 基础handler控制器处理器
 */
@Component
public class UserDataHandler extends AbstractCrudDataHandler {


    @Override
    public Mono<ServerResponse> save(ServerRequest serverRequest) {
        UserDTO userDTO = new UserDTO();
        userDTO.password = "12313";
        return restPost(serverRequest,userDTO);
    }

    @Override
    public Mono<ServerResponse> remove(ServerRequest serverRequest) {
        return restGet(serverRequest);
    }

    @Override
    public Mono<ServerResponse> load(ServerRequest serverRequest) {
        return restGet(serverRequest);
    }

    @Override
    public Mono<ServerResponse> search(ServerRequest serverRequest) {
        return restGet(serverRequest);
    }
}
